<template>
{{#if ctrl.psSysPFPlugin}}
    {{> @macro/plugins/widget/widget-use.hbs appPlugin=ctrl.psSysPFPlugin}}
{{else}}
  <AppExpBar 
    :class="classNames">
{{#if ctrl.showTitleBar}}
    <template #titleBar>
      <div class="control-header__left__caption">
  {{#if ctrl.psSysImage}}
    {{#if ctrl.psSysImage.imagePath}}
        <img src="{{ctrl.psSysImage.imagePath}}"/>
    {{/if}}
    {{#if ctrl.psSysImage.cssClass}}
        <i class="{{ctrl.psSysImage.cssClass}}"></i>
    {{/if}}
  {{/if}}
        <span class="text">\{{model.lanResTag ? $t(model.lanResTag, model.title) : model.title}}</span>
      </div>
    </template>
{{/if}}
    <template #quickGroup>
      <slot name="quickGroup"></slot>
    </template>
{{#if ctrl.enableSearch}}
    <template #quickSearch>
        {{> @macro/common/quick-search.hbs placeholder="model.quickSearchPlaceHolder"}}
    </template>
{{/if}}
{{#ctrl.ctrls}}
  {{#eq controlType 'TOOLBAR'}}
    <template #toolbar>
      {{> @macro/widgets/toolbar/toolbar.hbs ctrl=ctrl}}
    </template>
  {{/eq}}
{{/ctrl.ctrls}}
    <template #default>
{{#ctrl.ctrls}}
  {{#eq controlType "LIST"}}
      {{> @macro/widgets/list-detail/list.hbs ctrl=this props=":selectFirstDefault='true'
      :singleSelect='true'"}}
  {{/eq}}
{{/ctrl.ctrls}}
    </template>
  </AppExpBar>
{{/if}}
</template>
<script setup lang="ts">
// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@LISTEXPBAR}}-list-exp-bar/\{{ctrls@LISTEXPBAR}}-list-exp-bar.vue.hbs生成
{{> @macro/plugins/widget/widget-import.hbs ctrl=ctrl}}
import { AppExpBar } from '@components/widgets/exp-bar';
{{#ctrl.ctrls}}
  {{#eq controlType "LIST"}}
import {{codeName}}List from '@widgets/{{spinalCase appEntity.codeName}}/{{spinalCase codeName}}-list/{{spinalCase codeName}}-list.vue';
  {{/eq}}
{{/ctrl.ctrls}}
{{#hasCtrl ctrl.ctrls 'TOOLBAR'}}
import { AppToolbar } from '@components/widgets/toolbar';
{{/hasCtrl}}
import { ListExpBarActionType, ListExpBarController, IContext, IListExpBarAbility, IListExpBarControllerParams, IListExpBarStore, IParam, IListExpBarController, ILoadingHelper, createUUID, IViewCtx } from '@/core';
import {
  useNavParamsBind,
  useEventBind,
  getExpBarClassNames,
{{#hasCtrl ctrl.ctrls 'TOOLBAR'}}
  handleToolbarItemClick,
{{/hasCtrl}}
{{#if ctrl.enableSearch}}
  handleQuickSearch,
{{/if}}
  handleCtrlInit,
  handleCtrlAction,
  handleCtrlDestroy
} from '@/hooks/use-ctrl';
import { model } from './{{spinalCase ctrl.codeName}}-list-exp-bar-model';

{{> @macro/widgets/ctrl/ctrl-props.hbs
    props="openView?: Function;
    newView?: Function;
    "
}}

{{> @macro/common/emit.hbs name="ctrl" actionType="ListExpBarActionType" ability="IListExpBarAbility"}}

const classNames = computed(() => {
  return getExpBarClassNames(model, props);
});

const controlID = createUUID();

const params: IListExpBarControllerParams<ListExpBarActionType, IListExpBarAbility> = {
  name: props.name,
  model,
  evt,
  controlID,
  openView: props.openView,
  newView: props.newView,
  closeView: props.closeView,
  pLoadingHelper: props.pLoadingHelper,
  pViewCtx: props.pViewCtx,
  handler: (data: IListExpBarStore) => { return reactive(data); }
};
// 列表导航控制器
const controller: IListExpBarController<IListExpBarStore, IListExpBarAbility> = new ListExpBarController(params);
useNavParamsBind(controller, props);

const store: IListExpBarStore = controller.getStore();

onMounted(() => {
  controller.ctrlMounted();
});
onUnmounted(() => {
  controller.ctrlDestroy();
})
</script>